import { request } from '@umijs/max';

export async function fakeSubmitForm(params: any) {
  return request('/engine-service/api/advancedForm', {
    method: 'POST',
    data: params,
  });
}


export async function getSysDictByType(
  params: {
    [key: string]: any
  },
  options?: { [key: string]: any },
) {
  return request<{
    code: number;
    msg?: string;
    data?: Record<string, any>;
  }>('/engine-service/api/v1/sys_dict/list_by_category', {
    method: 'GET',
    params,
    ...(options || {}),
  });
}

export async function saveUiCasePage(
  data: {
    [key: string]: any
  },
  options?: { [key: string]: any },
) {
  return request<{
    code: number;
    msg?: string;
    data?: Record<string, any>;
  }>('/engine-service/api/v1/ui_case/save', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

export async function updateUiCasePage(
  data: {
    [key: string]: any
  },
  options?: { [key: string]: any },
) {
  return request<{
    code: number;
    msg?: string;
    data?: Record<string, any>;
  }>('/engine-service/api/v1/ui_case/update', {
    method: 'PUT',
    data,
    ...(options || {}),
  });
}

export async function getUiCasePage(
  params: {
    [key: string]: any
  },
  options?: { [key: string]: any },
) {
  return request<{
    code: number;
    msg?: string;
    data?: Record<string, any>;
  }>('/engine-service/api/v1/ui_case/find', {
    method: 'GET',
    params,
    ...(options || {}),
  });
}

export async function getSysByCode(
  params: {
    [key: string]: any
  },
  options?: { [key: string]: any },
) {
  return request<{
    code: number;
    msg?: string;
    data?: Record<string, any>;
  }>('/engine-service/api/v1/sys_dict/list_by_code', {
    params,
    ...(options || {}),
  });
}